#include<bits/stdc++.h>
using namespace std;

int a[200010];

int main()
{
	int n, k;
	cin>>n>>k;
	for(int i = 1;i <= n;i++)
	{
		cin>>a[i];
		a[i] += a[i-1];
	}
	
	int ans = 0;
	for(int i = 0;i <= n;i++)
	{
		for(int j = i+1;j <= n;j++)
		{
			if((a[j]-a[i])%k == 0)
				ans++;
		}
	}
	cout<<ans;
	return 0;
}

